import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    {
      path: "/home",
      name: "Home",
      meta: {
        title: "首页",
        showHeader: false,
        showFooter: true,
        showLogo: true,
        showBack: false,
      },
      component: () => import("../pages/home/Home.vue"),
    },
    {
      path: "/search",
      name: "Search",
      meta: {
        title: "搜索",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/search/Search.vue"),
    },
    {
      path: "/searchlist",
      name: "SearchList",
      meta: {
        title: "搜索列表",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/search/SearchList.vue"),
    },
    {
      path: "/addresslist",
      name: "AddressList",
      meta: {
        title: "地址列表",
        showHeader: false,
        showFooter: false,
        showLogo: false,
        showBack: true,
      },
      component: () => import("../pages/address/AddressList.vue"),
    },
    {
      path: "/addaddr",
      name: "Addaddr",
      meta: {
        title: "添加地址",
        showHeader: false,
        showFooter: false,
        showLogo: false,
        showBack: true,
      },
      component: () => import("../pages/address/Addaddr.vue"),
    },
    {
      path: "/addaddr2",
      name: "Addaddr2",
      meta: {
        title: "添加地址",
        showHeader: false,
        showFooter: false,
        showLogo: false,
        showBack: true,
      },
      component: () => import("../pages/address/Addaddr2.vue"),
    },
    {
      path: "/editaddr/:id",
      name: "Editaddr",
      meta: {
        title: "修改地址",
        showHeader: false,
        showFooter: false,
        showLogo: false,
        showBack: true,
      },
      component: () => import("../pages/address/Editaddr.vue"),
    },
    {
      path: "/cart",
      name: "Cart",
      meta: {
        title: "购物车",
        showHeader: false,
        showFooter: true,
      },
      component: () => import("../pages/cart/Cart.vue"),
    },

    {
      path: "/category",
      name: "Category",
      meta: {
        title: "分类",
        showHeader: false,
        showFooter: true,
      },
      component: () => import("../pages/category/Category.vue"),
    },
    {
      path: "/detail/:id",
      name: "Detail",
      meta: {
        title: "商品详情",
        showHeader: true,
        showFooter: false,
        showLogo: false,
        showBack: true,
      },
      component: () => import("../pages/detail/Detail.vue"),
    },

    {
      path: "/faxian",
      name: "Faxian",
      meta: {
        title: "发现",
        showHeader: true,
        showFooter: true,
        showLogo: true,
        showBack: false,
      },
      component: () => import("../pages/faxian/Faxian.vue"),
    },
    {
      path: "/login",
      name: "Login",
      meta: {
        title: "登录",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/login/Login.vue"),
    },
    {
      path: "/register",
      name: "Register",
      meta: {
        title: "注册",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/register/Register.vue"),
    },
    {
      path: "/mine",
      name: "Mine",
      meta: {
        title: "我的",
        showHeader: false,
        showFooter: true,
      },
      component: () => import("../pages/mine/Mine.vue"),
    },
    {
      path: "/setup",
      name: "Setup",
      meta: {
        title: "设置",
      },
      component: () => import("../pages/setup/Setup.vue"),
    },
    {
      path: "/personal-data",
      name: "Personal-data",
      meta: {
        title: "个人资料",
      },
      component: () => import("../pages/personal-data/Personal-data.vue"),
    },
    {
      path: "/account-security",
      name: "Account-security",
      meta: {
        title: "账户安全",
      },
      component: () => import("../pages/account-security/Account-security.vue"),
    },
    {
      path: "/mimashezhi",
      name: "Mimashezhi",
      meta: {
        title: "设置密码",
      },
      component: () => import("../pages/account-security/Mimashezhi.vue"),
    },
    {
      path: "/orderlist/:id",
      name: "OrderList",
      meta: {
        title: "订单确认",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/order/OrderList.vue"),
    },
    {
      path: "/buy",
      name: "Buy",
      meta: {
        title: "商品成交",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/order/Buy.vue"),
    },
    {
      path: "/allorderlist",
      name: "AllOrderList",
      meta: {
        title: "我的订单",
        showHeader: false,
        showFooter: false,
      },
      component: () => import("../pages/order/AllOrderList.vue"),
      children: [
        {
          path: "payorder",
          name: "PayOrder",
          meta: {
            title: "已支付",
          },
          component: () => import("../pages/order/PayOrder.vue"),
        },
        {
          path: "nopayorder",
          name: "NoPayOrder",
          meta: {
            title: "未支付",
          },
          component: () => import("../pages/order/NoPayOrder.vue"),
        },
      ],
    },
    {
      path: "/orderform",
      name: "Orderform",
      meta: {
        title: "我的订单",
      },
      component: () => import("../pages/Orderform/Orderform.vue"),
    },
    {
      path: "/collection",
      name: "Collection",
      meta: {
        title: "我的收藏",
      },
      component: () => import("../pages/Collection/Collection.vue"),
    },
    {
      path: "/coupon",
      name: "Coupon",
      meta: {
        title: "优惠券",
      },
      component: () => import("../pages/Coupon/Coupon.vue"),
    },

    {
      path: "/duihuan",
      name: "Duihuan",
      meta: {
        title: "兑换优惠券",
      },
      component: () => import("../pages/Coupon/Duihuan.vue"),
    },
  ],
});
export default router;
